﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.ModelBinding;
using System.Web.UI;
using System.Web.UI.WebControls;
using Box.BL;
using Box.Entities;
using Microsoft.Practices.Unity;

namespace WEB
{
    public partial class frmListVentas : System.Web.UI.Page
    {
        [Dependency]
        public IVentaBL ventaBl { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            var accion = Request.QueryString["opc"];
            var idc = Request.QueryString["id"];
            if (accion != null && accion.Equals("delete") && idc != null)
            {
                var idcc = Int32.Parse(idc.ToString());
                ventaBl.RemoveVenta(idcc);
                Response.Redirect("frmListVentas.aspx");
            }
        }

        public IEnumerable<Venta> GetVentas([Control("txtCriterio")] string criterio)
        {
            return ventaBl.GetFromVentasByCriterio(criterio);
        }
    }
}